home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / MACUNZIP / MACUNZIP._RE < prev    next >
Text File  |  1991-08-18  |  7KB  |  155 lines

  1. ------------------------------------------------------------------------
  2.  
  3. MacUnZip:  ZIP File Extraction Utility for the Macintosh
  4.  
  5.  
  6. John Eng    July 1991
  7.  
  8. (GEnie Mail Address:  J.ENG)
  9.  
  10. ------------------------------------------------------------------------
  11.  
  12.  
  13.  
  14. ------------
  15. INTRODUCTION
  16. ------------
  17.  
  18. MacUnZip unpacks ".ZIP" files, a packing/archiving format that is used on IBM 
  19. compatibles.  On the Macintosh, this program may be used to unpack text files 
  20. and certain standard data (e.g., MIDI) files created on an IBM compatible.  The 
  21. source code for MacUnZip is a modification of a modification:  it is based on 
  22. UNZIP Version 2.0.1 for the IBM by Samuel H. Smith, which was modified by George 
  23. M. Sipe for "portability" to UNIX, Microsoft C for the IBM, and other machines.  
  24. Accompanying this document should be the following files:
  25.  
  26.        File                        Description
  27.  
  28.      UNZIP.C             Smith/Sipe source code as modified by J. Eng
  29.      CRC32.C             Smith/Sipe source code as modified by J. Eng
  30.      CRC32.H             Smith/Sipe header file
  31.      UNZIP.DOC           Notes about UNZIP from Smith
  32.      README              Notes about UNZIP from Sipe
  33.      MacUnZip.c          Source code for the Mac and to enhance portability
  34.      MacUnZip.h          Header file for the Mac and to enhance portability
  35.      MacUnZip            Application compiled with Lightspeed C v2.01
  36.      MacUnZip ReadMe     This documentation file
  37.  
  38.  
  39.  
  40. ----------------------
  41. HOW TO USE THE PROGRAM
  42. ----------------------
  43.  
  44. MacUnZip is only one step in the process of converting a downloaded .ZIP file 
  45. into a file that can be used by a Macintosh application.  Summarized below are 
  46. the rest of the steps.  Because I am primarily interested in reading IBM text 
  47. and MIDI files, I will emphasize their unpacking in the steps below.
  48.  
  49.      (1)  Download the .ZIP file from a BBS using your communications program.  
  50. The communications software MUST NOT strip linefeeds while downloading the file.
  51.  
  52.      (2)  Run MacUnZip and specify the .ZIP filename.  MacUnZip and the .ZIP 
  53. file must be in the same folder.  The unpacked file(s) will also be placed in 
  54. the same folder.
  55.  
  56.      (3)  Use a resource editor (e.g., ResEdit by Apple Computer) or file 
  57. utility program (e.g., MacTools by Central Point Software, among many others) to 
  58. change the four-letter filetype from "TEXT" to "Midi" (note capitalization) if 
  59. the unpacked file is a standard MIDI file.  This step is obviously not required 
  60. if the unpacked file is a text file in the first place.  In that case, it should 
  61. be directly readable by most text editors and word processors.
  62.  
  63.      (4)  While doing step (3), the four-letter creatortype could also be 
  64. changed from "????" to that of an appropriate application on your system.  For 
  65. example, use "MTPC" for Master Tracks Pro by Passport Designs; "ttxt" for 
  66. TeachText by Apple Computer; or "MSWD" for Microsoft Word.  For other 
  67. applications, use the resource editor or file utility program from step (3) to 
  68. determine the four-letter creatortype for your particular application.
  69.  
  70.  
  71.  
  72. -------------------------
  73. NOTES ON PORTING THE CODE
  74. -------------------------
  75.  
  76. Although written with the intention of handling .ZIP files in non-IBM 
  77. environments, Samuel Smith's UNZIP is probably not generic enough for general 
  78. compilation.  (See Sipe's notes for details.)  George Sipe's modifications 
  79. significantly improved UNZIP's portability, but his use of UNIX libraries and 
  80. header files is still not quite generic enough.
  81.  
  82. All my modifications to UNZIP.C and CRC32.C are initialled "J.E." along with a 
  83. brief explanation.  Nothing was deleted from my starting copy of UNZIP.C; 
  84. unnecessary lines were commented out (and initialled "J.E.") instead of deleted.  
  85. I minimized my modifications to the original code, even at the expense of not 
  86. providing a Macintosh-type user interface, in order to enhance portability.  
  87. Below is a summary of my modifications for the benefit of others interested in 
  88. porting this code:
  89.  
  90.      (1)  Addition of a header file, MacUnZip.h, to declare non-portable symbols 
  91. and functions found in UNZIP.C, as well as compiler flags and an initialization 
  92. routine for the Macintosh.  MacUnZip.h also compensates for a memory restriction 
  93. of the Macintosh operating system and a memory allocation bug in Lightspeed C 
  94. v2.01.  Functions declared in MacUnZip.h are defined in MacUnZip.c, which is 
  95. appended to UNZIP.C with an #include directive.
  96.  
  97.      (2)  Substitution of UNIX header files with their Lightspeed C equivalents.  
  98. UNIX header files are only informally "standard."  I would suggest that any 
  99. further work with UNZIP.C rely only on the very basic symbols and functions 
  100. found in all C libraries.
  101.  
  102.      (3)  A bug was fixed by adding a size check while reading strings from the 
  103. .ZIP file.  The program otherwise would crash if the number of characters to be 
  104. read was greater than STRSIZ.
  105.  
  106.      (4)  An initialization routine, MacInit(), is used to provide the main() 
  107. routine with UNIX-style command line arguments.
  108.  
  109.      (5)  The program was compiled with Lightspeed C v2.01 and requires the 
  110. MacTraps, stdio, unix, and strings libraries of Lightspeed C.  UNZIP.C 
  111. #include's MacUnZip.h and MacUnZip.c; it also requires linking with CRC32.C.
  112.  
  113.  
  114.  
  115. ----------
  116. REFERENCES
  117. ----------
  118.  
  119. This work was made possible by a number of files downloaded from GEnie.  They 
  120. are briefly reviewed and credited below.
  121.  
  122.    File       GEnie Service   Library File            Description
  123.  
  124. UNZIP201.ARC     IBMPC           15607       Original IBM source code for UNZIP
  125.                                                by Smith/Sipe
  126. ARC/MID HELP     MAC             20312       A VERY helpful file explaining
  127.                                                how to unpack .ARC files and
  128.                                                general advice about downloading
  129.                                                and unpacking IBM files on the
  130.                                                Mac (by William Koehler)
  131. ARCHIVES.TXT     IBMPC           16122       A detailed explanation of the
  132.                                                various IBM and Mac file archive
  133.                                                formats (by Raymond Clay)
  134. ResEdit          MACPRO            --        The latest version can be found
  135.                                                here
  136.  
  137.  
  138.  
  139. ------------
  140. A FINAL NOTE
  141. ------------
  142.  
  143. Although MacUnZip has not been extensively tested, it seems to work pretty well 
  144. so far.  MacUnZip, like the original UNZIP, contains several unpacking 
  145. algorithms.  I have only unpacked files using the "un-implode" algorithm, which 
  146. is the one most commonly used.
  147.  
  148. If you find MacUnZip or its documentation useful, please send me a message via 
  149. GEnie Mail (address: J.ENG).  I would be glad to take bug reports via GEnie Mail 
  150. and work on the bug within a few days.  I would then send a reply to the bug 
  151. reporter and upload the fixed version.  Definitely let me know of your successes 
  152. in porting the code to other systems.  Thanks.
  153.  
  154. --John Eng (GEnie Mail: J.ENG)
  155.